<template>
    <div id="dataStatistics" class="dataStatistics same-change-oldstyle">
        <div class="bgfff" style="padding:0px 15px;box-sizing: border-box;">
             <div class="saem-seat-box" style="padding:18px 25px">
                <div class="saem-seat-left">
                    <span>当前位置：</span>
                    <el-breadcrumb separator-class="el-icon-arrow-right">
                        <el-breadcrumb-item :to="{ path: '/dataStatistics' }">首页</el-breadcrumb-item>
                        <!-- <el-breadcrumb-item>数据统计</el-breadcrumb-item> -->
                        <el-breadcrumb-item>数据台</el-breadcrumb-item>
                    </el-breadcrumb>
                </div>
                <div class="saem-seat-right">
                    <!-- <button class="same-search-btns same-search-export" >批量下载二维码</button> -->
                    <button class="same-search-btns same-search-export" @click="RefreshFun">刷新</button>
                    <!-- <button class="same-search-btns" @click="returnBack">返回</button> -->
                </div>
            </div>
        </div>
        <div class="headBox">
            <!--消息通知-->
            <div class="pl15 pr15 pb15 bgfff hboxsw minheadheight" v-if="moveText" >
              <router-link v-if="platform_bulletin.length>0" :to="{path:'/announcementDetail',query: {id: platform_bulletin[0].nid}}" class="notice_box">
                <div class="notice_lit"> 
                    <img src="../../../static/images/notice.png">
                    <div class="notice_content" id="noticeId" >{{moveText}}</div>
                </div>
                <!-- {{platform_bulletin[0].title}} -->
                <span class="notice_detail">查看详情></span>
                <!--<div class="close_btn" @click="closeNotice">×</div>-->
              </router-link>
            </div>

            <!--总统计-->
            <div class="bgfff pl15 mb15 hboxsw" style="margin-top:15px">
              <div class="table_title">
                <div class="title_block">汇总统计</div>
                <div class="choose_time">
                  <div class="on_choose_one" :class="{'on_show_it':check_total==0}" @click="chooseTotal(0)">所有</div>
                  <div class="on_choose_one" :class="{'on_show_it':check_total==1}" @click="chooseTotal(1)">昨天</div>
                  <div class="on_choose_one" :class="{'on_show_it':check_total==2}" @click="chooseTotal(2)">近7天</div>
                  <div class="on_choose_one" :class="{'on_show_it':check_total==3}" @click="chooseTotal(3)">近30天</div>
                </div>
              </div>
              <div class="total_box home_flex hboxsw" v-loading="loading_aa" element-loading-text="加载中...">
                <div class="radiusBox" v-for="(item,index) in dataCount" :key='index' v-if="(!isPartner&&item.name!='加盟商数')||isPartner">
                  <div class="lineBlock">
                    <div class="line_name">{{item.name}}</div>
                    <div class="line_value">{{item.data}}</div>
                  </div>
                  <div class="round1"></div>
                  <div class="round2"></div>
                </div>
              </div>
            </div>

            <!--排行榜-->
            <div class="rankBlock home_flex mb15">
              <div class="flex1 bgfff pl15 pr15 mr15">
                <div class="table_title flex_space">
                  <div class="home_flex">
                    <div class="title_block">设备收入排行榜</div>
                    <el-select size="mini" v-model="time_date1" style="width:80px" @change="changeOne">
                      <el-option label="昨天"  value="1"></el-option>
                      <el-option label="近7天" value="2"></el-option>
                      <el-option label="近30天"  value="3"></el-option>
                    </el-select>
                  </div>
                  <div class="choose_time">
                    <div class="on_choose_one" :class="{'on_show_it':check_one==1}" @click="chooseOne(1)">水卡</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_one==2}" @click="chooseOne(2)">微信</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_one==3}" @click="chooseOne(3)">支付宝</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_one==4}" @click="chooseOne(4)">投币</div>
                  </div>
                </div>
                <div class="table_boxs"  v-loading="loading_bb" element-loading-text="加载中...">
                    <table>
                        <thead>
                        <tr>
                            <th style="width: 30px;">排行</th>
                            <th>设备名</th>
                            <th v-if="check_one==1">水卡支付(金额/笔数)</th>
                            <th v-if="check_one==2">微信支付(金额/笔数)</th>
                            <th v-if="check_one==3">支付宝支付(金额/笔数)</th>
                            <th v-if="check_one==4">投币支付(金额/笔数)</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,index) in deviceRanking" :key="index">
                            <td><img class="rankImg" :src="'../../../static/images/rank'+ Number(index+1) +'.png'" v-if="index<3"><div v-else>{{index+1}}</div></td>
                            <td class="ovhidden">{{item.name}}</td>
                            <td >{{item.money|filterNumber}} / {{item.number?item.number:0}}</td>
                        </tr>
                        <tr>
                        <td colspan="3" v-if="deviceRanking.length<=0">
                          <div class="none-div-box">
                            <img src="../../../static/images/zwtj.png" alt="">
                            <span>暂无统计</span>
                          </div>
                        </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
              </div>
              <div class="flex1 bgfff pl15 pr15 mr15" v-if="isPartner">
                <div class="table_title flex_space">
                  <div class="home_flex">
                    <div class="title_block">加盟商收入排行榜</div>
                    <el-select size="mini" v-model="time_date2" style="width:80px" @change="changeTwo">
                      <el-option label="昨天"  value="1"></el-option>
                      <el-option label="近7天" value="2"></el-option>
                      <el-option label="近30天"  value="3"></el-option>
                    </el-select>
                  </div>
                  <div class="choose_time">
                    <div class="on_choose_one" :class="{'on_show_it':check_two==1}" @click="chooseTwo(1)">水卡</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_two==2}" @click="chooseTwo(2)">微信</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_two==3}" @click="chooseTwo(3)">支付宝</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_two==4}" @click="chooseTwo(4)">投币</div>
                  </div>
                </div>
                <div class="table_boxs"  v-loading="loading_cc" element-loading-text="加载中...">
                    <table>
                    <thead>
                    <tr v-if="partnerRanking.length>0">
                        <th style="width: 30px;">排行</th>
                        <th>加盟商名称</th>
                        <th v-if="check_two==1">水卡支付(金额/笔数)</th>
                        <th v-if="check_two==2">微信支付(金额/笔数)</th>
                        <th v-if="check_two==3">支付宝支付(金额/笔数)</th>
                        <th v-if="check_two==4">投币支付(金额/笔数)</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr v-for="(item,index) in partnerRanking" :key="index">
                        <td><img class="rankImg" :src="'../../../static/images/rank'+ Number(index+1) +'.png'" v-if="index<3"><div v-else>{{index+1}}</div></td>
                        <td class="ovhidden">{{item.name}}</td>
                        <td >{{item.money|filterNumber}} / {{item.number?item.number:0}}</td>
                    </tr>
                    <td colspan="3" v-if="partnerRanking.length<=0">
                      <div class="none-div-box">
                        <img src="../../../static/images/zwtj.png" alt="">
                        <span>暂无统计</span>
                      </div>
                    </td>
                    </tbody>
                    </table>
                </div>
              </div>
              <div class="flex1 bgfff pl15 pr15">
                <div class="table_title flex_space">
                  <div class="home_flex">
                    <div class="title_block">园区排行榜</div>
                    <el-select size="mini" v-model="time_date3" style="width:80px" @change="changeThree">
                      <el-option label="昨天"  value="1"></el-option>
                      <el-option label="近7天" value="2"></el-option>
                      <el-option label="近30天"  value="3"></el-option>
                    </el-select>
                  </div>
                  <div class="choose_time">
                    <div class="on_choose_one" :class="{'on_show_it':check_three==1}" @click="chooseThree(1)">水卡</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_three==2}" @click="chooseThree(2)">微信</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_three==3}" @click="chooseThree(3)">支付宝</div>
                    <div class="on_choose_one" :class="{'on_show_it':check_three==4}" @click="chooseThree(4)">投币</div>
                  </div>
                </div>
                <div class="table_boxs"  v-loading="loading_dd" element-loading-text="加载中...">
                    <table>
                    <thead>
                    <tr>
                        <th style="width: 30px;">排行</th>
                        <th>园区名称</th>
                        <th v-if="check_three==1">水卡支付(金额/笔数)</th>
                        <th v-if="check_three==2">微信支付(金额/笔数)</th>
                        <th v-if="check_three==3">支付宝支付(金额/笔数)</th>
                        <th v-if="check_three==4">投币支付(金额/笔数)</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr v-for="(item,index) in villageRanking" :key="index">
                        <td><img class="rankImg" :src="'../../../static/images/rank'+ Number(index+1) +'.png'" v-if="index<3"><div v-else>{{index+1}}</div></td>
                        <td class="ovhidden">{{item.name}}</td>
                        <td >{{item.money|filterNumber}} / {{item.number?item.number:0}}</td>
                    </tr>
                    <td colspan="3" v-if="villageRanking.length<=0">
                      <div class="none-div-box">
                        <img src="../../../static/images/zwtj.png" alt="">
                        <span>暂无统计</span>
                      </div>
                    </td>
                    </tbody>
                    </table>
                </div>
              </div>
            </div>

            <!--统计图-->
            <div class="bgfff pl15 pr15 mb15 hboxsw">
              <div class="table_title">
                <div class="title_block">收益统计</div>
                <div class="choose_time">
                  <div class="on_choose_one" :class="{'on_show_it':on_chart==4}" @click="incomeCount(4)">昨天</div>
                  <div class="on_choose_one" :class="{'on_show_it':on_chart==3}" @click="incomeCount(3)">近7天</div>
                  <div class="on_choose_one" :class="{'on_show_it':on_chart==2}" @click="incomeCount(2)">近30天</div>
                  <div class="on_choose_one" :class="{'on_show_it':on_chart==1}" @click="incomeCount(1)">近12月</div>
                </div>
              </div>
              <div id="earnings" ref="earnings" v-loading="loading_ee" element-loading-text="创建中..." style="height:400px;padding-top: 10px;"></div>
            </div>

            <div class="bgfff pl15 pr15 mb15">
              <div class="table_title">
                <div class="title_block">业务统计</div>
                <div class="choose_time">
                  <div class="on_choose_one" :class="{'on_show_it':on_cherts==4}" @click="multipleCount(4)">昨天</div>
                  <div class="on_choose_one" :class="{'on_show_it':on_cherts==3}" @click="multipleCount(3)">近7天</div>
                  <div class="on_choose_one" :class="{'on_show_it':on_cherts==2}" @click="multipleCount(2)">近30天</div>
                  <div class="on_choose_one" :class="{'on_show_it':on_cherts==1}" @click="multipleCount(1)">近12月</div>
                </div>
              </div>
              <div id="business" ref="business" v-loading="loading_ff" element-loading-text="创建中..." style="height:400px;padding-top: 10px;"></div>
            </div>

            <div class="rankBlock home_flex mb15" v-loading="loading_gg" element-loading-text="创建中..."  >
              <div class="flex1 bgfff pl15 pr15 mr15">
                <div class="table_title">
                  <div class="title_block">办卡统计</div>
                </div>
                <div class="rangeBlock">
                  <div class="range1_desc">
                    <div class="desc_text">普通水卡</div>
                    <div class="desc_num">{{card.ordinary_card}}张</div>
                  </div>
                  <div class="range1" :style="'width: '+range+'%;'"></div>
                  <div class="range2_desc">
                    <div class="desc_text">特殊水卡</div>
                    <div class="desc_num">{{Number(card.old_age_card) + Number(card.baby_card)}}张</div>
                  </div>
                  <div class="range2" :style="'width: '+(100-range)+'%;'"></div>
                </div>
              </div>
              <div class="flex1 bgfff pl15 pr15 mr15">
                <div class="table_title">
                  <div class="title_block">收入统计</div>
                </div>
                <div id="income" ref="income" style="height:300px"></div>
                <div class="notYet" v-if="!incomeHav">暂无数据</div>
              </div>
              <div class="flex1 bgfff pl15 pr15">
                <div class="table_title">
                  <div class="title_block">订单统计</div>
                </div>
                <div id="order" ref="order" style="height:300px"></div>
                <div class="notYet" v-if="!orderHav">暂无数据</div>
              </div>
            </div>

        </div>
    </div>
</template>
<script>
    //引入Echarts主模块
    let echarts = require('echarts/lib/echarts');
    export default {
        name: 'informMsg',
        data: function () {
            return {
                loading_aa:false,//加载中 模块1
                loading_bb:false,//加载中 模块2
                loading_cc:false,//加载中 模块3
                loading_dd:false,//加载中 模块4
                loading_ee:false,//加载中 模块5
                loading_ff:false,//加载中 模块6
                loading_gg:false,//加载中 模块7
                on_chart: 1,//选择chart1   收益统计
                on_cherts: 1,//选择chart2  业务统计
                platform_bulletin: [],//通知消息
                dataCount:[],    //汇总统计
                deviceRanking:[0],//设备收入排行榜
                partnerRanking:[0],//和后人收入排行
                villageRanking:[0],//园区收入排行榜
                card: [],
                range:'',//比例
                check_total: 0,//总统计选择-------日期（0:所有，1：昨天，2：近七天，3：近30天）
                check_one:1, //排行排序选择，设备收入   排序（1：水卡（默认），2：在线，3：积分,4：投币）
                check_two:1, //排行排序选择，加盟商收入 (同上)
                check_three:1, //排行排序选择，园区     (同上)
                time_date1: '1',//设备收入排行榜-----日期（1：昨天（默认），2：7天，3：一个月）
                time_date2: '1',//加盟商收入排行榜   (同上)
                time_date3: '1',//园区排行榜         (同上)
                isPartner:false,//是否是合伙人默认值 false;
                moveText:"",
                incomeHav:false,//默认没有数据
                orderHav:false,//默认没有数据
            }
        },
        computed: {},
        created: function () {
          this.$emit('gitHidden', true);//是否隐藏底部版权 true 隐藏 
        },
        inject: [
            'reload'
        ],
        methods: {
            RefreshFun(){
                // 调用reload方法，刷新整个页面
                this.reload()
            },
            //返回
            returnBack(){
                this.$router.back(-1);
            },
            /*  --------------------------------------------------------------------------------------------   */
            //切换总统计时间 顶部 日期（0:所有，1：昨天，2：近七天，3：近30天）
            chooseTotal(val){
               this.check_total = val;
              this.datasCountOne(val);
            },

            /*  --------------   */
            //选择排行方式，设备收入 排序（1：水卡（默认），2：在线，3：积分,4：投币）
            chooseOne(val){
              this.check_one = val;
              this.devicesRanking(this.check_one,this.time_date1); //设备收入排行榜---板块2
            },
            //选择天数,设备收入  日期（1：今日（默认），2：7天，3：一个月）
            changeOne(val){
                this.devicesRanking(this.check_one,val); //设备收入排行榜---板块2
            },

            /*  --------------   */
            //选择排行方式，加盟商收入排序（1：水卡（默认），2：在线，3：积分,4：投币）
            chooseTwo(val){
              this.check_two = val;
              this.partnersRanking(this.check_two,this.time_date2);
            },
            //选择天数,设备收入  日期（1：今日（默认），2：7天，3：一个月）
            changeTwo(val){
                this.partnersRanking(this.check_two,val); //设备收入排行榜---板块2
            },

            /*  --------------   */
            //选择排行方式，园区排行 排序（1：水卡（默认），2：在线，3：积分,4：投币）
            chooseThree(val){
              this.check_three = val;
              this.villagesRanking(this.check_three,this.time_date3);
            },
             //选择天数,园区排行  日期（1：今日（默认），2：7天，3：一个月）
            changeThree(val){
                this.villagesRanking(this.check_three,val); //设备收入排行榜---板块2
            },

            /*创建图表一  收益统计*/
            createChartOne(data, abscissa) {
                let earnings = echarts.init(this.$refs.earnings);
                earnings.setOption({
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                      data:['充值收益','在线打水收益','投币打水收益']
                    },
                    color:['#D72121','#2C5586','#FEAC2D','#23AEB3'],
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                           saveAsImage: {
                            show: false,
                    　　　　 excludeComponents :['toolbox'],
                    　　　　 pixelRatio: 2
                          }
                        }
                    },
                    xAxis: {
                        type: 'category',
                        splitLine: {show: false}, //保留网格线
                        splitArea: {show: false}, //保留网格区域
                        boundaryGap: false,
                        // data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日', '最后', '之后', '以后', '再来', '最后']
                        data: abscissa
                    },
                    yAxis: {
                        type: 'value',
                        splitLine: {show: true}, //保留网格线
                        splitArea: {show: false} //保留网格区域
                    },
                    series: //data,
                      [

                        {
                          name:'充值收益',
                          type:'line',
                          smooth: true,
                          label: {
                            normal: {
                              show: true,
                              position: 'top'
                            }
                          },
                          data: data[0].data,
                        }, {
                          name:'在线打水收益',
                          type:'line',
                          smooth: true,
                          label: {
                            normal: {
                              show: true,
                              position: 'top'
                            }
                          },
                          data: data[1].data,
                        }, {
                          name:'投币打水收益',
                          type:'line',
                          smooth: true,
                          label: {
                            normal: {
                              show: true,
                              position: 'top'
                            }
                          },
                          data: data[2].data,
                        },
                      ]
                })
            },
            /*创建图表二  业务统计*/
            createChartTwo(data, abscissa) {
                var that=this;
                let business = echarts.init(this.$refs.business);
                business.setOption({
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: ['新增设备数','办卡数','打水订单数']
                    },
                    color:['#F2A687','#FEC772','#49B271'],
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                          saveAsImage: {
                            show: false,
                    　　　　 excludeComponents :['toolbox'],
                    　　　　 pixelRatio: 2
                          }
                        }
                    },
                    xAxis: {
                        type: 'category',
                        splitLine: {show: false}, //保留网格线
                        splitArea: {show: false}, //保留网格区域
                        boundaryGap: false,
                        data: abscissa
                    },
                    yAxis: {
                        type: 'value',
                        splitLine: {show: true}, //保留网格线
                        splitArea: {show: false} //保留网格区域
                    },
                    series: //data
                      [
                        {
                          name:'新增设备数',
                          type:'line',
                          smooth: true,
                          label: {
                            normal: {
                              show: true,
                              position: 'top'
                            }
                          },
                          areaStyle: {
                            color: 'rgb(250,224,216)',
                          },
                          data: data[0].data,
                        }, {
                          name:'办卡数',
                          type:'line',
                          smooth: true,
                          label: {
                            normal: {
                              show: true,
                              position: 'top'
                            }
                          },
                          areaStyle: {
                            color: 'rgb(255,235,204)',
                          },
                          data: data[1].data,
                        }, {
                          name:'打水订单数',
                          type:'line',
                          smooth: true,
                          label: {
                            normal: {
                              show: true,
                              position: 'top'
                            }
                          },
                          areaStyle: {
                            color: 'rgb(191,230,210)',
                          },
                          data: data[2].data,
                        }
                      ]
                })
                setTimeout(()=>{
                  that.loading_ff=false;
                },600)
            },
            // 创建饼图             收入统计   订单统计
            createChartPie(data){
              var that=this;
              data.income.forEach((item,index)=>{
                  if(parseFloat(item.value)!=0){
                     this.incomeHav=true;
                  }
              })
              data.order.forEach((item,index)=>{
                  // console.log('得到的订单',index,parseFloat(item.value),item.value);
                  if(parseFloat(item.value)!=0){
                     this.orderHav=true;
                  }
              })

              // console.log('最后的数据',this.orderHav==false,this.incomeHav ,'订单',this.orderHav)
              var colorList1=this.incomeHav==false?['#D0D0D0','#E0E0E0','#F0F0F0','#D8D6D6']:['#D72121','#2C5586','#FEAE33','#34B4B9'];
              var colorList2=this.orderHav==false?['#D8D6D6','#D0D0D0','#E0E0E0','#F0F0F0']:['#ED8464','#009B4D','#B600F2','#FEAE33'];
              // 收入统计，
              let income = echarts.init(this.$refs.income);
              income.setOption({
                tooltip : {
                  trigger: 'item',
                  formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                  show: false,
                  x : 'center',
                  y : 'bottom',
                  data:['水卡充值收入','在线打水收入','投币打水收入']
                },
                color:colorList1,
                series : [
                  {
                    type:'pie',
                    radius : [30, 80],
                    center : ['50%', '50%'],
                    // roseType : 'radius',
                    // width: '20%',       // for funnel
                    // x: '10%',
                    data: data.income
                  }
                ]
              });
              // 订单统计
              let order = echarts.init(this.$refs.order);
              order.setOption({
                tooltip : {
                  trigger: 'item',
                  formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                  show: false,
                  x : 'center',
                  y : 'bottom',
                  data:['线下支付订单','在线支付订单','投币支付订单']
                },
                color:colorList2,
                series : [
                  {
                    type:'pie',
                    radius : [30, 80],
                    center : ['50%', '50%'],
                    // roseType : 'radius',
                    // width: '20%',       // for funnel
                    // x: '10%',
                    data: data.order
                  }
                ]
              });
              setTimeout(()=>{
                  that.loading_gg=false;
              },600)
            },
            //顶部系统消息 0
            messagefun() {
                var that = this;
                that.$post({
                    url: "Partner/Console/message",
                    data: {},
                    success: (data) => {
                        if (data.code == 1000) {
                            that.platform_bulletin = data.data.platform_bulletin;
                            // that.moveText = that.filtersText(data.data.platform_bulletin[0].content);
                            that.moveText=data.data.platform_bulletin[0].short_desc;  
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                    }
                })
            },
            filtersText(val) { // 要判断一下,如果是空就返回空字符串,不然会报错
                if (val != null && val != '') {
                  var reg = /[\u4e00-\u9fa5]/g
                  var names = val.match(reg)
                  val = names.join('')
                  return val
                } else return ''
              },
             //汇总统计----------板块1 
            datasCountOne(type) {
                var that = this;
                that.loading_aa=true;
                that.$post({
                    url: "Partner/Console/dataCount",
                    data: {type},//日期（0:所有，1：昨天，2：近七天，3：近30天）
                    success: (data) => {
                        if (data.code == 1000) {
                            that.dataCount = data.data.data;
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                        setTimeout(()=>{
                            that.loading_aa=false;
                        },600)
                    }
                })
            },
            //设备收入排行榜--------板块2
            devicesRanking(type,date){
                var that = this;
                that.loading_bb=true;
                that.$post({
                    url: "Partner/Console/deviceRanking",
                    data: {type,date},//type 排序（1：水卡（默认），2：微信，3：支付宝,4：投币） date日期（1：今日（默认），2：7天，3：一个月）
                    success: (data) => {
                        if (data.code == 1000) {
                            that.deviceRanking = data.data;
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                        setTimeout(()=>{
                            that.loading_bb=false;
                        },600)
                    }
                })
            },
            //加盟商收入排行榜---------板块3
            partnersRanking(type,date){
                 var that = this;
                that.loading_cc=true;
                that.$post({
                    url: "Partner/Console/partnerRanking",
                    data: {type,date},//type 排序（1：水卡（默认），2：微信，3：支付宝,4：投币） date日期（1：今日（默认），2：7天，3：一个月）
                    success: (data) => {
                        if (data.code == 1000) {
                            that.partnerRanking = data.data;
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                        setTimeout(()=>{
                            that.loading_cc=false;
                        },600)
                    }
                })
            },
            //园区收入排行榜---------板块4
            villagesRanking(type,date){
                 var that = this;
                that.loading_dd=true;
                that.$post({
                    url: "Partner/Console/villageRanking",
                    data: {type,date},//type 排序（1：水卡（默认），2：微信，3：支付宝,4：投币） date日期（1：今日（默认），2：7天，3：一个月）
                    success: (data) => {
                        if (data.code == 1000) {
                            that.villageRanking = data.data;
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                        setTimeout(()=>{
                            that.loading_dd=false;
                        },600)
                    }
                })
            },
            // -------------------------------------------------------------------以下就是echarts--------------------------------------------------------------
            //收益统计---------板块5
            incomeCount(type) {
                var that = this;
                that.loading_ee=true;
                that.on_chart = type;
                that.$post({
                    url: "Partner/Console/newIncomeCount",
                    data: {type},
                    success: (data) => {
                        if (data.code == 1000) {
                            this.createChartOne(data.data.data, data.data.abscissa);
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                         setTimeout(()=>{
                            that.loading_ee=false;
                        },600)
                    }
                })
            },
            //业务统计---------板块6 
            multipleCount(type) {
                var that = this;
                that.loading_ff=true;
                that.on_cherts = type;
                that.$post({
                    url: "Partner/Console/newMultipleCount",
                    data: {type},
                    success: (data) => {
                        if (data.code == 1000) {
                            this.createChartTwo(data.data.data, data.data.abscissa);
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                        
                    }
                })
            },
            //普通水卡和特殊水卡比例  收入统计  订单统计  -------------办卡统计( 板块   6   7   8 )
            businessStatistics(){
              var that = this;
               that.loading_gg=true;
              that.$post({
                    url: "Partner/Console/businessStatistics",
                    data: {},
                    success: (data) => {
                        if (data.code == 1000) {
                            that.card = data.data.card;

                            var cardData = data.data.card;
                            that.range = Number(cardData.ordinary_card)/(Number(cardData.ordinary_card) + Number(cardData.old_age_card) + Number(cardData.baby_card) + Number(cardData.other_card))*100;
                            var incomeData = data.data.income;
                            var orderData = data.data.order;
                            var chartIncome = {
                              income: [
                                {name: '水卡充值收入', value: incomeData.water_card_recharge},
                                {name: '在线打水收入', value: incomeData.sale_water},
                                {name: '投币打水收入', value: incomeData.coin_water},
                              ],
                              order: [
                                {name: '线下支付订单', value: orderData.card_pay},
                                {name: '在线支付订单', value: orderData.online},
                                {name: '投币支付订单', value: orderData.coin},
                              ]
                            };

                            that.createChartPie(chartIncome);
                        } else {
                            this.$message({
                                showClose: true,
                                message: data.message,
                                center: true
                            });
                        }
                        
                    }
                })
            },
            // -----------------------------------------------------------------------echart生成完毕---------------------------------------------------------
            //获取合伙人信息
            getPartnerMsg(){
                var that = this;
                that.$post({
                    url:'Partner/Setup/get_partner',
                    data:{
                    },
                    success:function(data){
                        that.userinfo = data.data;
                        if(data.data.superior_id == '0'){//superior_id大于0 加盟商
                            that.isPartner = true;
                            that.partnersRanking(this.check_two,this.time_date2);//加盟商收入排行---板块3(需要先判断是否是合伙人)
                        }else{
                          that.isPartner = false;
                        }
                    }

                })
            },
            //暂时不需处理的接口;
            getConsole() {
                this.$message({
                    showClose: true,
                    message: '数据每两小时更新',
                    center: true,
                    type: 'warning'
                });
            }

        },
        //初始化
        mounted() {
            // this.getConsole();
            this.messagefun();//通知消息-----顶部
            this.datasCountOne(this.check_total);//汇总统计--------板块1
            this.devicesRanking(this.check_one,this.time_date1); //设备收入排行榜---板块2
            this.getPartnerMsg();//需要先判断是否是合伙人 //this.partnersRanking(this.check_two,this.time_date2);//加盟商收入排行---板块3(需要先判断是否是合伙人)
            this.villagesRanking(this.check_three,this.time_date3);//园区排行---板块4
            this.incomeCount(1);//收益统计---板块5
            this.multipleCount(1);//业务统计-----板块6
            this.businessStatistics();//普通水卡和特殊水卡比例  收入统计  订单统计  -------------办卡统计( 板块   7   8   9)
        },
        // 更新的时候运动
        updated: function () {
        },
    }

</script>
<style scoped>
.none-div-box{
  width: 100%;
  height:330px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.none-div-box span{
  font-size: 12px;
  color:#CCCCCC;
  padding-top: 20px;
}
.wrap {
  overflow: hidden;
}

.box {
  width: 80000%;
}

.box div {
  float: left;
}

.marquee {
   margin: 0 16px 0 0;
}

.node {
  position: absolute;
  z-index: -999;
  top: -999999px;
}
    .dataStatistics {
        width: 100%;
        height: 100%;
        background: #fafafa;
    }

    .headBox {
        /* background: #F2F3F3; */
        display: flex;
        width: 100%;
        flex-direction: column;
    }

    #dataStatistics .el-input--suffix .el-input__inner{
        height: 22px;
    }

    #dataStatistics .el-input__prefix, .el-input__suffix{
        top:4px;
    }

    .bgfff{
      background: #fff;
    }
    .table_boxs{
        min-height: 380px;
    }
    table{
      width: 100%;
      padding-bottom: 10px;
    }
    thead tr{
      border-bottom: 1px dashed #ededed;
    }
    th,td{
      font-weight: normal;
      font-size: 12px;
      text-align: center;
      padding: 5px 5px 5px 0;
    }
    .pl15{
      padding-left: 15px;
    }
    .pr15{
      padding-right: 15px;
      box-shadow: 0 1px 4px 0 rgba(0,0,0,.05);
    }
    .pb15{
      padding-bottom: 15px;
    }
    .mr15{
      margin-right: 15px;
    }
    .mb15{
      margin-bottom: 15px;
    }
    .hboxsw{
      box-shadow: 0 1px 4px 0 rgba(0,0,0,.05);
    }
    .rankImg{
      width: 25px;
    }
    .ovhidden{
        width:50%;
        overflow: hidden;
        text-overflow:ellipsis;
        white-space: nowrap;
    }
    .time_date{
      border: 1px solid #1C487D;
      border-radius: 10px;
      color: #1C487D;
    }
    .home_flex{
      display: flex;
      align-items: center;
    }
    .flex1{
      flex: 1;
      min-width: 30%;
      position: relative;
    }
    .flex_space{
      justify-content: space-between!important;
    }
    .rankBlock{
      align-items: stretch!important;
    }

    /*  通知消息  */
    .notice_box{
      height: 40px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 14px;
      background: #FFF6F3;
      border-radius: 0 0 10px 10px;
      padding:0 14px;
      position: relative;
      
    }
    .notice_box .notice_lit{
      display: flex;
      align-items: center;
      width:92%;
    }
    .notice_box img{
      width: 34px;
      margin-right: 10px;
    }
    .notice_box .notice_content{
      color: #ED8566;
      width: 100%;
      max-width: 1200px;
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
    }
    .minheadheight{
      min-height: 40px;
    }
    .notice_box .notice_detail{
      color: #666;
      margin-left: 15px;
    }
    .notice_box .close_btn{
      width: 40px;
      height: 40px;
      line-height: 40px;
      text-align: center;
      color: #666;
      font-size: 20px;
      position: absolute;
      top: 0;
      right: 0;
      z-index: 2;
    }

    /*  统计数据块 */
    .headBox .total_box{
      padding: 15px 0;
      min-height: 147px;
    }
    .radiusBox{
      flex: 1;
      position: relative;
      background: #fff;
      border-radius: 10px;
      margin-right: 15px;
      box-shadow:0px 0px 3px 0px rgba(0, 0, 0, 0.1);
      overflow: hidden;
    }
    .lineBlock{
      padding: 30px 0 30px 10%;
      position: relative;
      z-index: 2;
    }
    .line_name{
      font-size: 16px;
      margin-bottom: 5px;
    }
    .line_value{
      font-size: 24px;
      font-weight: 500;
    }
    .radiusBox:nth-child(1) .lineBlock{
      color: #1C487D;
      border-left: 4px solid #1C487D;
    }
    .radiusBox:nth-child(2) .lineBlock{
      color: #15A9AE;
      border-left: 4px solid #15A9AE;
    }
    .radiusBox:nth-child(3) .lineBlock{
      color: #b600f2;
      border-left: 4px solid #b600f2;
    }
    .radiusBox:nth-child(4) .lineBlock{
      color: #FEAC2D;
      border-left: 4px solid #FEAC2D;
    }
    .radiusBox:nth-child(5) .lineBlock{
      color: #D41010;
      border-left: 4px solid #D41010;
    }
    .radiusBox:nth-child(6) .lineBlock{
      color: #EB7956;
      border-left: 4px solid #EB7956;
    }
    .radiusBox:nth-child(7) .lineBlock{
      color: #009644;
      border-left: 4px solid #009644;
    }
    .round1{
      width: 60px;
      height: 60px;
      border-radius: 50%;
      position: absolute;
      right: -10px;
      top: -10px;
      z-index: 1;
      opacity: 0.35;
    }
    .round2{
      width: 110px;
      height: 110px;
      border-radius: 50%;
      position: absolute;
      right: -30px;
      bottom: -30px;
      z-index: 1;
      opacity: 0.6;
    }
    .radiusBox:nth-child(1) .round1, .radiusBox:nth-child(1) .round2{
      background: #eef5ff;
    }
    .radiusBox:nth-child(2) .round1, .radiusBox:nth-child(2) .round2{
      background: #e5fbf8;
    }
    .radiusBox:nth-child(3) .round1, .radiusBox:nth-child(3) .round2{
      background: #fcf4ff;
    }
    .radiusBox:nth-child(4) .round1, .radiusBox:nth-child(4) .round2{
      background: #fff7ec;
    }
    .radiusBox:nth-child(5) .round1, .radiusBox:nth-child(5) .round2{
      background: #ffeeee;
    }
    .radiusBox:nth-child(6) .round1, .radiusBox:nth-child(6) .round2{
      background: #fff0eb;
    }
    .radiusBox:nth-child(7) .round1, .radiusBox:nth-child(7) .round2{
      background: #ddffee;
    }

    .table_title{
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      border-bottom: 1px solid #ededed;
      padding: 8px 0;
    }
    .title_block{
      font-size: 14px;
      font-weight: 500;
      margin-right: 10px;
    }
    .choose_time {
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      overflow: hidden;
    }
    .on_choose_one {
      font-size: 12px;
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      padding: 2px 5px;
      cursor: pointer;
      color: #CBCBCB;
      border: 1px solid #CBCBCB;
      /*border-right: none;*/
      margin-right: -1px;
    }
    .on_choose_one:first-child{
      border-radius: 10px 0 0 10px;
    }
    .on_choose_one:last-child{
      border-radius: 0 10px 10px 0;
      border: 1px solid #CBCBCB;
      margin-right: 0;
    }
    .on_show_it {
      border: 1px solid #2c5586!important;
      color: #2c5586!important;
      z-index: 2;
    }

    .rangeBlock{
      width: 100%;
      height: 300px;
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      align-items: center;
      position: relative;
      padding-top: 30px;
      box-sizing: border-box;
    }
    .range1{
      width: 30%;
      height:10px;
      background: #D20707;
      margin-right: 10px;
      border-radius: 10px;
    }
    .range1_desc{
      position: absolute;
      top: calc(50% - 60px);
      left: 0;
      color: #D20707;
    }
    .range2_desc{
      position: absolute;
      top: calc(50% - 60px);
      right: 0;
      color: #FEAE33;
      text-align: right;
    }
    .desc_text{
      font-size: 16px;
    }
    .desc_num{
      font-size: 28px;
    }
    .range2{
      width: 70%;
      height:10px;
      background: #FEAE33;
      border-radius: 10px;
    }
    .notYet{
      color: #FFF;
      background: #D8D8D8;
      font-size: 14px;
      padding: 4px 7px;
      border-radius: 12px;
      position: absolute;
      bottom: 20px;
      right: 20px;
    }
</style>
